package stu.sup.controller.product;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import stu.sup.entity.Product;
import stu.sup.service.IProductService;

import javax.servlet.http.HttpServletRequest;
@Controller
public class ProductController {
    @Autowired
    private IProductService productService;
    @GetMapping("product")
    public String gotoProduct(Model model, HttpServletRequest request){
       String productId=request.getParameter("id");

        Product product=productService.selectbyId(Integer.parseInt(productId));

        model.addAttribute("product",product);
        return "view/product";
    }
}
